package ynu.beggar.server.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import ynu.beggar.server.entities.PO.ForumPostPO;

import java.util.List;

@Repository
public interface ForumPostDao extends PagingAndSortingRepository<ForumPostPO, Integer> {

//    Page<ForumPostPO> findAllByPostTypeAndDelIsNullOrDelNot_deprecate(Pageable pageable, String type, int del);

    List<ForumPostPO> findByPostIdAndUserIdAndDelIsNullOrDelNot(int postId, int userId, int del);

    List<ForumPostPO> findByPostIdAndUserId(int postId, int userId);

    Page<ForumPostPO> findAllByPostTypeAndDelIsNullOrDelNot(String type, int isDel, Pageable pageable);

    List<ForumPostPO> findAllByUserIdAndDelIsNullOrDelNot(int userId, int isDel, Pageable pageable);

    ForumPostPO findByPostId(int postId);
}
